package com.trg.flex.dt
{
	import flash.events.Event;

	/**
	 * Fired from DataTables and Columns when an item is clicked.
	 */
	public class DataTableEvent extends Event
	{
		public static const CLICK:String = "clickAction";
		public static const DOUBLE_CLICK:String = "doubleClickAction";
		
		public function DataTableEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(type, bubbles, cancelable);
		}
		
		/**
		 * The item that was clicked.
		 */
		public var item:*;
		
		/**
		 * The selected item in the table when the event was fired.
		 */
		public var selectedItem:*;
		
		/**
		 * The selected items in the table when the event was fired.
		 */
		public var selectedItems:Array;
		
		/**
		 * The column that was clicked, if any.
		 */
		public var column:Column;
		
		/**
		 * Make a copy of this event.
		 */
		public function copy():DataTableEvent {
			var event:DataTableEvent = new DataTableEvent(type, bubbles, cancelable);
			event.column = column;
			event.item = item;
			event.selectedItem = selectedItem;
			event.selectedItems = selectedItems;
			return event;
		}
	}
}